<!--
*@Author: QWP
*@Description: 
*@Date: 2024-07-05 14:32:51
-->
<template>
  <a-config-provider 
    :locale="zhCN"
    :theme="theme">
    <div id="app">
      <router-view></router-view>
    </div>
  </a-config-provider>
</template>

<script lang='ts' setup>
import { ref, reactive, computed, onMounted, onBeforeUnmount, watch } from 'vue' 
import { storeToRefs } from 'pinia'
import { useHomeStore } from '@/store'
import { checkUpdate } from '@/views/login/getVerision.js'
import { theme } from 'ant-design-vue';
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
const { bodyFontSize } = storeToRefs(useHomeStore())

let timer = ref(null);
let showNew = ref<boolean>(false);

const theme = computed(() => {
  return {
    token: {
      colorPrimary: '#1890ff',
      colorLink: '#1890ff',
      fontSize: bodyFontSize.value, // 12  14  16
      Layout: {
        colorBgBody: 'unset'
      },
      Menu: {
        
      },
      Table: {
        tableFontSize: 14
      }
    }
  }
})

watch(() => bodyFontSize, (nval, oval) => {
  document.documentElement.style.setProperty('--font-size-level-1', nval.value + 'px')
}, { immediate: true, deep: true })

onBeforeUnmount(() => {
  clearInterval(timer)
})

const lunxun = () => {
  // timer.value = setInterval(checkUpdate, 1000 * 60 * 2)
}

const checkUpdate = (init) => {
  checkUpdate().then(res => {
    if(res == true) {
      showNew.value = true;
    }
  })
}

</script>

<style lang='scss'>
:root {
  --font-size-level-0: calc(var(--font-size-level-1) - 2px);
  --font-size-level-2: calc(var(--font-size-level-1) + 2px)
}
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
@font-face {
  font-family: 'PingFang SC Regular';
  src: url('./assets/font/PingFangRegular.otf') format('opentype');
}
// @font-face {
//   font-family: 'PingFang SC';
//   src: url('./assets/font/PingFangRegular.otf') format('opentype');
// }
@font-face {
  font-family: 'PingFang SC Regular-Regular';
  src: url('./assets/font/PingFangRegular.otf') format('opentype');
}
@font-face {
  font-family: 'PingFang SC Medium';
  src: url('./assets/font/PingFangMedium.otf') format('opentype');
}

html,body {
  width: 100%;
  height: 100%;
  font-size: 16px;
  min-width: 1200px;
  font-family: PingFang SC-Medium, 
    PingFang SC,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,'Noto Sans',
    'Apple Color Emoji',
    'Segoe UI Emoji',
    'Segoe UI Symbol',
    'Noto Color Emoji',
    '微软雅黑',
    'Microsoft YaHei',
    sans-serif,
}
#app {
  height: 100%;
  width: 100%;
}

</style>